package com.axxc.jpa.pattendegign.prototype;

import com.axxc.jpa.pattendegign.commons.C;

// 优点:1、性能提高。 2、逃避构造函数的约束。
//缺点 必须实现Cloneable接口,否则报classNotSupportedException
public class Shoes implements C, Cloneable {

	private static final long serialVersionUID = 1L;

	private String name;

	public Shoes(String name) {
		super();
		this.name = name;
	}

	@Override
	public void show() {
		System.out.println(name);
	}

	@Override
	public Object clone() throws CloneNotSupportedException {
		return super.clone();
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public static void main(String[] args) throws Exception {

		Shoes shoes = new Shoes("aaa");

		Shoes clone = (Shoes) shoes.clone();
		clone.setName("bbbbbbbb");
		System.out.println(clone.getName());

	}

}
